package dq.study.minimvc.context;

import dq.study.minimvc.util.ScanPackageUtil;

import java.util.Map;

public class ContextLoader {

    private volatile static ContextLoader contextLoader;
    private Map<String, Object> handlers;

    private ContextLoader(){

    }

    public synchronized static ContextLoader getInstance(){
        if(contextLoader == null ){
            synchronized(ContextLoader.class){
                if(contextLoader ==null )
                    contextLoader = new ContextLoader();
            }
        }
        return contextLoader ;
    }


    public void initBean() {
        handlers = ScanPackageUtil.scanPackage("dq.study.minimvc.test");
    }

    public Map<String, Object> getHandlers() {
        return handlers;
    }
}
